;
(function() {
	module.exports = {
		prefix: "/sse",
		get: {
			"/conn": function(req, res) {
				res.writeHead(200, {
					"Content-Type": "text/event-stream",
					"Cache-Control": "no-cache",
					"Connection": "keep-alive"
				});
				var query = req.query;
				if (!(query.type && query._id)) {
					throwCusError("参数错误")
				}

				res.write("retry: 10000\n");
				res.write("event: connecttime\n");
				res.write("data: " + (new Date()) + "\n\n");
				res.write("data: " + (new Date()) + "\n\n");

				interval = setInterval(function() {
					res.write("data: " + (new Date()) + "\n\n");
				}, 1000);

				req.connection.addListener("close", function() {
					clearInterval(interval);
				}, false);
			}
		}
	}
}());